home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / GETTIME3.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-25  |  2.5 KB  |  80 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Time Sample Program"
  4.    ClientHeight    =   4215
  5.    ClientLeft      =   1455
  6.    ClientTop       =   2130
  7.    ClientWidth     =   3405
  8.    Height          =   4620
  9.    Left            =   1395
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4215
  12.    ScaleWidth      =   3405
  13.    Top             =   1785
  14.    Width           =   3525
  15.    Begin MabryTime Time1 
  16.       Blocking        =   -1  'True
  17.       Host            =   "mit.edu"
  18.       Left            =   0
  19.       Top             =   0
  20.    End
  21.    Begin CommandButton Command1 
  22.       Caption         =   "Get Time"
  23.       Height          =   375
  24.       Left            =   1560
  25.       TabIndex        =   2
  26.       Top             =   600
  27.       Width           =   1560
  28.    End
  29.    Begin CheckBox Check1 
  30.       Caption         =   "Blocking"
  31.       Height          =   330
  32.       Left            =   240
  33.       TabIndex        =   1
  34.       Top             =   600
  35.       Value           =   1  'Checked
  36.       Width           =   1050
  37.    End
  38.    Begin Label Label3 
  39.       Caption         =   "You must be connected to the Internet through a TCP/IP connection for this program to work."
  40.       Height          =   855
  41.       Left            =   240
  42.       TabIndex        =   4
  43.       Top             =   3240
  44.       Width           =   2895
  45.    End
  46.    Begin Label Label2 
  47.       Caption         =   "Press the Get Time button to attempt to get the current Greenwich Mean Time from mit.edu (MIT).  The Blocking button determines if this is done synchronously or asynchronously. You can change the time server by changing the HostName property of the Time1 control."
  48.       Height          =   1935
  49.       Left            =   240
  50.       TabIndex        =   3
  51.       Top             =   1200
  52.       Width           =   2895
  53.    End
  54.    Begin Label Label1 
  55.       Height          =   330
  56.       Left            =   240
  57.       TabIndex        =   0
  58.       Top             =   120
  59.       Width           =   2895
  60.    End
  61. Option Explicit
  62. Sub Command1_Click ()
  63.     Time1.Blocking = Check1.Value
  64.     Command1.Enabled = False
  65.     On Error Resume Next
  66.     Time1.Action = 1
  67.     If (Err <> 0 And Err <> 10035) Then
  68.         MsgBox Error
  69.         End If
  70.     On Error GoTo 0
  71.     If (Time1.Blocking = True) Then
  72.         Label1.Caption = Time1.GMTTime
  73.         Command1.Enabled = True
  74.         End If
  75.     End Sub
  76. Private Sub Time1_Done (ErrorCode As Integer)
  77.     Command1.Enabled = True
  78.     Label1.Caption = Time1.GMTTime
  79.     End Sub
  80.